$(function(){
		$('#contact').contactable({
	 		subject: 'A Feeback Message'
	 	});
		//页面内跳动
		 $(".scroll").click(function(event){
	        event.preventDefault();
	 
	        var full_url = $(this).attr("alt");
	        //alert(full_url);
	        var target_offset = $("#"+full_url).offset();
	        var target_top = target_offset.top;
	        $('html, body').animate({scrollTop:target_top}, 10);
	    });
		// remove layerX and layerY
	    var all = $.event.props,
       len = all.length,
       res = [];
	    while (len--) {
	      var el = all[len];
	      if (el != 'layerX' && el != 'layerY') res.push(el);
	    }
	    $.event.props = res;
		//等页面加载完再加载某部分内容
		$(document).ready(function(){
			//课程简介
			$.get("/courses/index.php/index/kechengjiankuang", function(data){
				  $("#kechengjiankuang").html(data);
					
					//主讲教师
					$.get("/courses/index.php/index/zhujiangjiaoshi", function(data){
						   $("#zhujiangjiaoshi").html(data);
							//教学内容
							$.get("/courses/index.php/index/jiaoxueneirong", function(data){
								   $("#jiaoxueneirong").html(data);

									//实践教学图片显示
									$("#foo2").carouFredSel({
										circular: false,
										infinite: false,
										auto 	: false,
										scroll	: {
											items	: "page"
										},
										prev	: {	
											button	: "#foo2_prev",
											key		: "left"
										},
										next	: { 
											button	: "#foo2_next",
											key		: "right"
										},
										pagination	: "#foo2_pag"
									});
									//教学条件
									$.get("/courses/index.php/index/jiaoxuetiaojian", function(data){
										   $("#jiaoxuetiaojian").html(data);
										   //教材图片滚动
										    var outer		= $("#preview_outer");
											var arrow		= $("#arrow");
											var thumbs		= $("#thumbs span");

											var preview_pos;
											var preview_els	= $("#preview_inner div");
											var image_width	= preview_els.eq(0).width(); // Get width of imaages
											
											// Hook up the click event
											thumbs.click(function() {
												// Get position of current image
												preview_pos = preview_els.eq( thumbs.index( this) ).position();

												// Animate them!
												outer.stop().animate( {'scrollLeft' : preview_pos.left},	500 );
												arrow.stop().animate( {'left' : $(this).position().left },	500 );
											});

											// Reset positions on load
											arrow.css( {'left' : thumbs.eq(0).position().left } ).show();
											outer.animate( {'scrollLeft' : 0}, 0 );

											// Set initial width
											$("#preview_inner").css('width', preview_els.length * image_width);

											//实验设备
											$("#foo22").carouFredSel({
												circular: false,
												infinite: false,
												auto 	: false,
												scroll	: {
													items	: "page"
												},
												prev	: {	
													button	: "#foo2_prev2",
													key		: "left"
												},
												next	: { 
													button	: "#foo2_next2",
													key		: "right"
												},
												pagination	: "#foo2_pag2"
											});

											//教学参考
											$.get("/courses/index.php/index/jiaoxuecankao", function(data){
												   $("#jiaoxuecankao").html(data);
												   
													//教学录像
													$.get("/courses/index.php/index/jiaoxueluxiang", function(data){
														   $("#jiaoxueluxiang").html(data);
															


															//教学科学研究
															$.get("/courses/index.php/index/jiaoxuekexueyanjiu", function(data){
																   $("#jiaoxuekexueyanjiu").html(data);
															});

															//申报书
															$.get("/courses/index.php/index/shenbaoshu", function(data){
																   $("#shenbaoshu").html(data);
															});
													});
											});
									});
								   
							});
					});
			});
		});				
	});